<?php

namespace App\Models\Admin;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class Project extends Model
{
    protected $table_name = 'project';
    
	protected $fillable = [
        'id', 'name', 'created_at', 'updated_at'
    ];

    public function getProjectListWithFields()
    {
        $res = DB::table($this->table_name)
            ->select('name')
            ->where("mall_id", request()->mallData["id"])
            ->get();
        if(!$res){
            return false;
        }
        $res = json_decode(json_encode($res),true);
        if(!is_array($res) || count($res)<1){
            return false;
        }
        return $res;
    }
}
